import { useEffect } from 'react';
import { useRoutes, matchRoutes } from 'react-router-dom';
import routerMap from './routerConfig';

const Router = () => {
  const routerTab = useRoutes(routerMap);
  // 二次鉴权，根据当前路由路径进行匹配是否存在当前路由，不存在则跳转404或者500等错误页面
  // useEffect(() => {}, []);
  console.log(location.pathname);
  const routes = matchRoutes(routerMap, location.pathname);
  console.log(routes, 'routes');
  return routerTab;
};

export default Router;
